package com.pattern.structural.adaptor.class2;

/**
 * @Description Adapter,Object-type adapter , makes adaptee to implement target interface.
 * @Author Ping
 * @Date 2022/3/29 14:26
 **/
public class ObjAdapter implements EUsedElectricity{
    // composing the home used elect
    private HomeUsedElectricity homeUsedElectricity ;

    public ObjAdapter(HomeUsedElectricity homeUsedElectricity) {
        this.homeUsedElectricity = homeUsedElectricity;
    }

    public void setHomeUsedElectricity(HomeUsedElectricity homeUsedElectricity) {
        this.homeUsedElectricity = homeUsedElectricity;
    }

    @Override
    public void chargeWith22V() {
        this.homeUsedElectricity.chargeWith220V();
        System.out.println("adapt 220 to 20v") ;
    }
}
